<template>
	<view class="form">
		<view class="item">
			<view class="title_sub">申请人姓名:<text class="must red">*</text></view>
			<view class="inpit_wrap">
				<input placeholder="请输入申请人真实姓名" v-model="form.basicBorrowerName"/>
			</view>
		</view>
		<view class="item">
			<view class="title_sub">身份证号码:<text class="must red">*</text></view>
			<view class="inpit_wrap">
				<input placeholder="请输入申请人身份证号码" v-model="form.basicBorrowerCard" />
			</view>
		</view>
		<view class="item">
			<view class="title_sub">联系电话:<text class="must red">*</text></view>
			<view class="inpit_wrap">
				<input placeholder="请输入联系电话" v-model="form.basicBorrowerPhone"/>
			</view>
		</view>
		<view class="item">
			<view class="title_sub">居住地址:<text class="must red">*</text></view>
			<view class="inpit_wrap">
				<input placeholder="居住地址" v-model="form.basicBorrowerAddress"/>
			</view>
		</view>
		<view class="item">
			<view class="title_sub">申请金额:<text class="must red">*</text></view>
			<view class="inpit_wrap">
				<input placeholder="申请金额" v-model="form.basicLoansMoney"/><text>( 万 )</text>
			</view>
		</view>
	</view>
</template>

<script>
	import graceChecker from '@/common/graceChecker.js'
	import formRuleConfig from '@/config/formRule.config.js'
	export default {
		data() {
			return{
				form:{
					basicBorrowerName: "",
					basicBorrowerCard: "",
					basicBorrowerPhone: "",
					basicBorrowerAddress: "",
					basicLoansMoney: ""
				}
			}
		},
		props:["productId"],
		methods: {
			submit() {
				//校验格式
				let checkRes = graceChecker.check(this.form, formRuleConfig.orderRule01);
				if (!checkRes) {
					uni.showToast({
						title: graceChecker.error,
						icon: "none"
					});
					return;
				}
				let data = JSON.parse(JSON.stringify(this.form))
				data.productId = this.productId;
				this.$api.newOrder(data).then( res => {
					let orderNum = res.data.data;
					uni.redirectTo({
						url:"/pages/orderInside/orderResult?orderNumber=" + orderNum
					})
				})
				
			}
		}
	}
</script>

<style scoped lang="scss">
	.form{
		.item{height: 80rpx;display: flex;justify-content: space-between;align-items: center;border-bottom: 1px solid #eee;}
		.title_sub{font-size: 30rpx;font-weight: 500;}
		.inpit_wrap{display: flex;justify-content: flex-end;align-items: center;flex: 1;}
		.inpit_wrap input{flex: 1;text-align: right;font-size: 26rpx;}
	}
</style>
